package com.k1998.mybatis.controller;

import com.k1998.mybatis.bean.Message;
import com.k1998.mybatis.service.impl.MessageImpl;
import com.k1998.mybatis.utils.BatchInfo;
import com.k1998.mybatis.utils.QueryInfo;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(tags = {"留言功能Api文档"})
public class MessageController {
    @Autowired
    private MessageImpl messages;
    @PostMapping("/detailMessage")
    public String detailMessage(@RequestBody Message message){
        return messages.detailMessage(message);
    }
    @PostMapping("/insertMessage")
    public String insertMessage(@RequestBody Message message){
        return messages.insertMessage(message);
    }
    @PostMapping("/updateMessageById")
    public String updateMessageById(@RequestBody Message message){
        return messages.updateMessageById(message);
    }
    @PostMapping("/batchDeleteMessage")
    public String batchDeleteMessage(@RequestBody BatchInfo info){
        return messages.batchDeleteMessage(info)>0?"success":"error";
    }
    @PostMapping("/findMessageByDisplay")
    public String findMessageByDisplay(@RequestBody QueryInfo queryInfo){
        return messages.findMessageByDisplay(queryInfo);
    }
    @PostMapping("/reversalMessageDisplay")
    public String reversalMessageDisplay(@RequestBody BatchInfo batchInfo){
        return messages.reversalMessageDisplay(batchInfo);
    }
}
